package com.sky.utils;

import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

/**
 * Map参数构造
 *
 * @author ttao
 * @since 2023/5/3 20:36
 */
public class MapParamUtil {

    /**
     * 根据传入的参数构建查询的map集合
     *
     * @param status    订单状态
     * @param beginTime 开始时间
     * @param endTime   结束时间
     * @return
     */
    public static Map<String, Object> getMap(Integer status, LocalDateTime beginTime, LocalDateTime endTime) {
        Map<String, Object> map = new HashMap<>();
        if (status != null) {
            map.put("status", status);
        }
        map.put("begin", beginTime);
        map.put("end", endTime);
        return map;
    }

    /**
     * 根据传入的参数构建查询的map集合
     *
     * @param type    来单类型 1 来单提醒 2催单
     * @param orderId 订单id
     * @param content 订单号
     * @return
     */
    public static Map<String, Object> getMap(Integer type, Long orderId, String content) {
        Map<String, Object> map = new HashMap<>();
        map.put("type", type);
        map.put("orderId", orderId);
        map.put("content", content);
        return map;
    }

    /**
     * 根据传入的参数构建查询的map集合
     *
     * @param status 菜品起售/停售状态
     * @return
     */
    public static Map<String, Object> getMap(Integer status) {
        Map<String, Object> map = new HashMap<>();
        map.put("status", status);
        return map;
    }

    /**
     * 构建配送范围参数
     *
     * @return
     */
    public static Map<String, String> getAddressMap(String address, String type, String ak) {
        Map<String, String> map = new HashMap<>();
        map.put("address", address);
        map.put("output", type);
        map.put("ak", ak);
        return map;
    }

    public static Map<String, String> getRouteMap(String origin, String destination, String ak){
        Map<String, String> map = new HashMap<>();
        map.put("origin", origin);
        map.put("destination", destination);
        map.put("ak", ak);
        return map;
    }
}
